home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 8 / Revista CD Expert nº 08 CD1.iso / Utilitarios / Programacao / Pacific C for DOS / INCLUDE / ASSERT.H next >
C/C++ Source or Header  |  1995-03-08  |  528b  |  21 lines

  1. /*
  2.  *    Assertion - use liberally for debugging. Defining NDEBUG
  3.  *    turns assertions off.
  4.  *    assert(exp) where exp is non-zero does nothing, while
  5.  *    assert(exp) where exp evaluates to zero aborts the program
  6.  *    with a message like
  7.  *
  8.  *    Assertion failed: prog.c line 123: "exp"
  9.  *
  10.  */
  11.  
  12. #ifndef    NDEBUG
  13. #ifndef    __mkstr__
  14. #define    __mkstr__(exp)    #exp
  15. #endif
  16. extern void    _fassert(int, char *, char *);
  17. #define    assert(exp)    if(!(exp)) {_fassert(__LINE__, __FILE__, __mkstr__(exp));}
  18. #else
  19. #define    assert(exp)
  20. #endif
  21.